package org.niu.listnode;

public class FindKthToTail {
    public ListNode FindKthToTail (ListNode pHead, int k) {
        // write code here
        ListNode p1=pHead,p2 = pHead;
        while (k > 0){
            k--;
            p1 = p1.next;
        }
        while(p1!=null){
            p1 = p1.next;
            p2 = p2.next;
        }
        return p2;
    }
}
